package com.momo.mapper.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.momo.mapper.dataobject.ItemStockDO;
import com.momo.mapper.mapper.ItemStockDOMapper;

/**
* The Table ITEM_STOCK.
* 注意:此结构有系统生成,禁止手工修改,以免被覆盖,请通过dalgen生成
* ITEM_STOCK
*/
@Repository
public class ItemStockDAO{

    @Autowired
    private ItemStockDOMapper itemStockDOMapper;

    /**
     * desc:插入表:ITEM_STOCK.<br/>
     * descSql =  SELECT LAST_INSERT_ID() INSERT INTO ITEM_STOCK( STOCK ,ITEM_ID )VALUES( #{stock,jdbcType=INTEGER} ,#{itemId,jdbcType=INTEGER} )
     * @param entity entity
     * @return int
     */
    public int insert(ItemStockDO entity){
        return itemStockDOMapper.insert(entity);
    }
    /**
     * desc:更新表:ITEM_STOCK.<br/>
     * descSql =  UPDATE ITEM_STOCK SET STOCK = #{stock,jdbcType=INTEGER} ,ITEM_ID = #{itemId,jdbcType=INTEGER} WHERE ID = #{id,jdbcType=INTEGER}
     * @param entity entity
     * @return int
     */
    public int update(ItemStockDO entity){
        return itemStockDOMapper.update(entity);
    }
    /**
     * desc:根据主键删除数据:ITEM_STOCK.<br/>
     * descSql =  DELETE FROM ITEM_STOCK WHERE ID = #{id,jdbcType=INTEGER}
     * @param id id
     * @return int
     */
    public int deleteById(Integer id){
        return itemStockDOMapper.deleteById(id);
    }
    /**
     * desc:根据主键获取数据:ITEM_STOCK.<br/>
     * descSql =  SELECT * FROM ITEM_STOCK WHERE ID = #{id,jdbcType=INTEGER}
     * @param id id
     * @return ItemStockDO
     */
    public ItemStockDO getById(Integer id){
        return itemStockDOMapper.getById(id);
    }
}
